<script>
    // let test=1

    // ;(function(window,undefined){
    //     let jquery=function(){

    //     }
    //     window.jquery=window.$=jquery
    // })(window)
    // console.log($);
    // console.log(jquery);

</script>
<div>001</div>
<div>002</div>
<div>003</div>

<script>
; (function (window, undefined) {
    function init(el) {
        let els = document.querySelectorAll(el)
        for (let i = 0; i < els.length; i++) {
            this[i] = els[i]
        }
        this.length = els.length
    }
    let jQuery = function (el) {
        return new init(el)
    }
    jQuery.extend = function (object) {
        for (let key in object) {
            init.prototype[key] = object[key]
        }
    }
    init.prototype = {
        //加样式
        css(cssAttr, cssVal) {
            for (let i = 0; i < this.length; i++) {
                this[i].style[cssAttr] = cssVal
            }
            return this
        },
        //加属性
        attr(attrClass, attrValue) {
            for (let i = 0; i < this.length; i++) {
                this[i].setAttribute([attrClass], attrValue)
            }
            return this
        }
    }
    window.jQuery = window.$ = jQuery
})(window)
</script>